package net.ojbk.study.twobox.beans.form.query;

import net.ojbk.study.twobox.beans.form.InputItem;
import net.ojbk.study.twobox.beans.po.Refer;
import net.ojbk.study.twobox.beans.vo.SelectOption;
import net.ojbk.study.twobox.dao.StaffMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: twobox
 * Date: 2019/4/16
 * Time: 10:32
 * Description: No Description
 */
@Component
public class ReferQueryForm extends SupperQueryForm<Refer> {
    private InputItem inputItemStaff = new InputItem("负责人",
            "userid",
            "",
            "select", null);

    @Autowired
    public ReferQueryForm(StaffMapper staffMapper) {

        this.inputItems.add(new InputItem("咨询学生姓名",
                "username",
                "",
                "text"));
        List<SelectOption> sourceList = new ArrayList<>();
        // 网站|现场|电话|邮件
        sourceList.add(new SelectOption("网站", "网站"));
        sourceList.add(new SelectOption("现场", "现场"));
        sourceList.add(new SelectOption("电话", "电话"));
        sourceList.add(new SelectOption("邮件", "邮件"));

        this.inputItems.add(new InputItem("咨询来源",
                "source",
                "网站",
                "select", sourceList));

        this.inputItems.add(inputItemStaff);
    }

    @Override
    public List<InputItem> getInputItems() throws Exception {
        this.inputItemStaff.setOther(this.selectOptionUtil.getSelectOptionListByName("staff"));
        return super.getInputItems();
    }
}
